﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MMMaze
{


    public interface  IAxis<T>
    {
        string Name
        {
            get;
            set;
        }

        T Next { get; set; }
        T Previous { get; set; }
        T GetNeighbor(AxisDirection direction);
        void SetNeighbor(AxisDirection direction, T value);
    }

    public class LinkAxis<T> : IAxis<T>
    {

        protected   T[] Links;
        public LinkAxis()
        {
            Links =new T[3];
      
        
        }

        #region IAxis<T> Members

        public string Name
        {
            get;
            set;
        }



        #endregion

        #region IAxis<T> Members


        public T Next
        {
            get
            {
                return Links[0];
            }
            set
            {
                Links[0] = value;
            }
        }

        public T Previous
        {
            get
            {
                return Links[2];
            }
            set
            {
                Links[2] = value;
            }
        }

        #endregion

        #region IAxis<T> Members


        public T GetNeighbor(AxisDirection direction)
        {
           return Links[(int) direction +1];
        }
        public void  SetNeighbor(AxisDirection direction ,T value)
        {
         Links[(int)direction + 1]=value ;
        }

        #endregion
    }

}
